Clover coverage report - Flock Flock - 0.7-dev
Coverage timestamp: Thu Jan 30 2003 01:35:37 EST
file stats: LOC: 73   Methods: 2
NCLOC: 53   Classes: 1
This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
XTree.java 0% 0% 0% 0%
 1   
 package net.sf.flock.webapp.tree;
 2   
 
 3   
 import net.sf.tapestry.IAsset;
 4   
 import net.sf.tapestry.IMarkupWriter;
 5   
 import net.sf.tapestry.IRequestCycle;
 6   
 import net.sf.tapestry.RequestCycleException;
 7   
 import net.sf.tapestry.html.Body;
 8   
 
 9   
 public class XTree extends Tree {
 10   
 
 11   
     private final static String[] ICONS = new String[] {
 12   
         "rootIcon",
 13   
         "openRootIcon",
 14   
         "folderIcon",
 15   
         "openFolderIcon",
 16   
         "fileIcon",
 17   
         "iIcon",
 18   
         "lIcon",
 19   
         "lMinusIcon",
 20   
         "lPlusIcon",
 21   
         "tIcon",
 22   
         "tMinusIcon",
 23   
         "tPlusIcon",
 24   
         "blankIcon"
 25   
     };
 26   
 
 27   
     /**
 28   
      * @see net.sf.tapestry.AbstractComponent#renderComponent(IMarkupWriter, IRequestCycle)
 29   
      */
 30  0
     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 31   
         // get Body and contribute script asset
 32  0
         Body body = Body.get(cycle);
 33  0
         IAsset script = this.getAsset("xtreeScript");
 34  0
         body.includeScript( script.buildURL(cycle) );
 35   
         
 36  0
         writer.printRaw("<link rel='stylesheet' type='text/css' href='" + this.getAsset("xtreeStylesheet").buildURL(cycle) +"'/>");
 37   
 
 38  0
         writer.begin("script");
 39  0
         writer.attribute("language", "JavaScript");
 40  0
         writer.print("if (document.getElementById) {\n");
 41   
 
 42   
         // generate tree config
 43  0
         writer.print("webFXTreeConfig = {\n");
 44  0
         for (int i=0; i<ICONS.length; i++) {
 45  0
             String url = this.getAsset( ICONS[i] ).buildURL(cycle);
 46  0
             body.getPreloadedImageReference( url );
 47  0
             writer.printRaw( ICONS[i] + ": '" + url + "',\n" );
 48   
         }
 49  0
         writer.print("defaultText : 'Tree Item',\n");
 50  0
         writer.print("defaultAction : 'javascript:void(0);',\n");
 51  0
         writer.print("defaultBehavior : 'classic'\n");
 52  0
         writer.print("};\n");
 53   
 
 54  0
         super.renderComponent(writer, cycle);
 55   
 
 56  0
         writer.print("document.write(t1); }");
 57  0
         writer.end();
 58   
     }
 59   
 
 60   
     /**
 61   
      * @see net.sf.flock.webapp.tree.Tree#renderCurrentNode(IMarkupWriter, IRequestCycle)
 62   
      */
 63  0
     protected void renderCurrentNode(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 64  0
         if (this.getDepth()==1) {
 65  0
             writer.print( "t1 = new WebFXTree('" + this.getValue().getId() + "');\n");
 66   
         } else {
 67  0
             writer.print( "t" + this.getDepth() +" = new WebFXTreeItem('" + this.getValue().getId() + "');\n");
 68  0
             writer.print( "t" + (this.getDepth()-1)+".add( t" + this.getDepth() + " );\n" );
 69   
         }
 70   
     }
 71   
 
 72   
 }
 73